#include"my_List.h"

void ListTest01()
{
	//初始化双向链表使其开始有个哨兵位最先
	//LTNode* plist = NULL;
	//LTInit(&plist);
	LTNode* plist = LTInit();

	//测试尾插
	LTPushBack(plist, 1);
	LTPrintf(plist);
	LTPushBack(plist, 2);
	LTPrintf(plist);
	LTPushBack(plist, 3);
	LTPrintf(plist);
	LTPushBack(plist, 4);
	LTPrintf(plist);

	//测试头插
	//LTPushFront(plist, 5);
	//LTPushFront(plist, 6);
	//LTPushFront(plist, 7);
	//LTPushFront(plist, 8);
	//LTPrintf(plist);

	//测试尾删
	//LTPoBack(plist);
	//LTPrintf(plist);
	//LTPoBack(plist);
	//LTPrintf(plist);
	//LTPoBack(plist);
	//LTPrintf(plist);
	//LTPoBack(plist);
	//LTPrintf(plist);
	//LTPoBack(plist);

	//测试头删
	//LTPopFront(plist);
	//LTPrintf(plist);
	//LTPopFront(plist);
	//LTPrintf(plist);
	//LTPopFront(plist);
	//LTPrintf(plist);
	//LTPopFront(plist);
	//LTPrintf(plist);
	//LTPopFront(plist);

	//测试在pos节点后插入节点
	LTNode* find = LTFind(plist, 1);
	LTInsert(find, 5);
	LTPrintf(plist);//1 5 2 3 4

	//测试删除pos节点

	LTErase(find);//删1
	find = NULL;
	LTPrintf(plist);//5 2 3 4

	find = LTFind(plist, 4);
	LTErase(find);//删4
	LTPrintf(plist);//5 2 3

	find = LTFind(plist, 2);
	LTErase(find);//删2
	LTPrintf(plist);//5 3

	LTDesTory(plist);
	plist = NULL;

}
//文件之间联系必须靠声明，声明的才可以跨文件

int main()
{
	ListTest01();
	return 0;
}